#include <stdio.h>
#include <string.h> 

int movex[]={-2,-2,-1,-1,1,1,2,2};
int movey[]={-1,1, -2,2,-2,2,-1,1};

int flag[8][8] = {0};
int recordx[27],recordy[27];
int ansX[27], ansY[27];
int maxX, maxY;
int over;

void search(int x, int y, int step)
{
     int i;
     int tox, toy;
     flag[x][y] = 1;
     recordx[step] = x;
     recordy[step] = y;
     if (over == 1) return ;
     if (step == maxX * maxY) 
     {
         over = 1;
         for (i = 1; i <= step; ++i)
         {
             ansX[i] = recordx[i];
             ansY[i] = recordy[i];
         }
     } else {
         for (i = 0; i < 8; ++ i) 
         {
             tox = x + movex[i];
             toy = y + movey[i];
             if (tox >= 0 && tox < maxX && toy >=0 && toy < maxY 
                && flag[tox][toy] == 0 ) 
             {
                   search(tox, toy, step + 1);
             }
         }
     }
     flag[x][y] = 0;
}

int main()
{
    int i, ncase;
    int j, k;
    scanf("%d", &ncase);
    for (i = 0; i < ncase; ++ i) 
    {
        scanf("%d%d", &maxY, &maxX);
        over = 0;
        memset(flag, 0, sizeof(flag));
        for (j = 0; j < maxX; ++j)
        {
            for (k = 0; k < maxY; ++k) 
                if (over == 0) 
                   search(j, k, 1);
        } // end of search
        printf("Scenario #%d:\n", i+1);
        if (over == 0)
            printf("impossible\n");
        else 
        {
            for ( j = 1; j <= maxX * maxY; ++ j)
               printf("%c%d", ansX[j]+'A', ansY[j]+1);
            printf("\n");
        }
        printf("\n");
    }
    return 0;
}
/*
4
4 3
1 1
2 3

*/
